<template>
  <div class="box">
    <!-- 菜单页面内容 -->

    <div class="box_top">
      <!-- 头部 -->
      <div class="box_top_head">
        <van-nav-bar title="地址详情" left-text="返回" left-arrow @click-left="onClickLeft" />
      </div>
      <!-- 我的页面内容 -->
      <div class="box_top_content">
        <van-address-edit
          :area-list="areaList"
          show-postal
          show-delete
          show-set-default
          show-search-result
          :search-result="searchResult"
          :area-columns-placeholder="['请选择', '请选择', '请选择']"
          @save="onSave"
          @delete="onDelete"
          @change-detail="onChangeDetail"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      areaList:{},
      searchResult: []
    };
  },
  // 注册组件
  components: {},
  methods: {
    //    回到上一个页面
    onClickLeft() {
      this.$router.go(-1); //返回上一层
    },
    onSave() {
      Toast("save");
    },
    onDelete() {
      Toast("delete");
    },
    onChangeDetail(val) {
      if (val) {
        this.searchResult = [
          {
            name: "黄龙万科中心",
            address: "杭州市西湖区"
          }
        ];
      } else {
        this.searchResult = [];
      }
    }
  }
};
</script>
<style scoped lang="less">
.box {
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  .box_top {
    background-color: #f7f8fa;
    height: 100vh; //底部加1px的边框
    overflow: auto;
    border-bottom: 1px solid #f3f3f3;
    .box_top_head {
      position: fixed;
      width: 100%;
      top: 0;
      left: 0;
      height: 46px;
      background-color: #fff;
      z-index: 10;
    }
    .box_top_content {
      margin-top: 46px;
    }
  }
}
</style>
